package com.yidu.CashAdministration.mapper;

import com.yidu.CashAdministration.entity.MoneyAllocateEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface MoneyAllocateMapper {
    //分页
    @Select("SELECT m.*,c.accounName FROM (Select * from moneyAllocate WHERE 1=1 ${moneyAllocate} order by moneyAllocateId ) m JOIN cash c ON m.cashId=c.cashId limit #{page},#{limit}")
    public List<MoneyAllocateEntity> moneyAllocateSelect(Map map);
    //数量
    @Select("SELECT COUNT(*) FROM moneyAllocate m JOIN cash c ON m.cashId=c.cashId WHERE 1=1 ${allocate}")
    public int selectCount(Map map);
    //增加
    @Insert("insert into moneyAllocate value(#{moneyAllocateId},#{fundId},#{cashId},#{allocateMoney},#{allocateType},#{allocateFlow},#{businessId},#{allocateDate},#{businessDate},#{moneyAllocateBeiZhu})")
    public int moneyAllocateInsert(MoneyAllocateEntity moneyAllocateEntity);
    //修改
    @Update("update moneyAllocate set moneyAllocateId=#{moneyAllocateId},fundId=#{fundId},cashId=#{cashId},allocateMoney=#{allocateMoney},allocateType=#{allocateType},allocateFlow=#{allocateFlow},businessId=#{businessId},allocateDate=#{allocateDate},businessDate=#{businessDate},moneyAllocateBeiZhu=#{moneyAllocateBeiZhu} where moneyAllocateId = #{moneyAllocateId} ")
    public void moneyAllocateUpdate(MoneyAllocateEntity moneyAllocateEntity);
    //删除
    @Delete("delete from moneyAllocate where moneyAllocateId=#{moneyAllocateId} ")
    public int moneyAllocateDelete(String moneyAllocateId);
}

